-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Authentication, Translations, Navigation updates #20
Authentication, Translations, Navigation updates #20
Conversation
@dessalines - we have come up with 2 different authentication approaches in these latest PRs happy to go with whichever you think is best :) |
Some of the problems our PRs solve overlap and some don't. Some notes on your PR:
|
thanks for looking at the PR! i hope we can use the best bit from both our PRs.
i had no issues at all making authentication calls from server functions or content API calls to Voyager in SSR mode. Voyager also sets CORS headers to allow the same API calls direct from the browser. i'm also seeing personalized data when i set the Authorization headers, so that all seems to be working great. maybe some network peculiarities are preventing you from doing the same, or calling your own dev lemmy API.
this is the first iteration of my browser/server cookie handling code. open to any suggestions to improve any code in the PR. Rust wonderfully makes us aware of all the possibilities that emerge from our code. i have tried to allow errors to gracefully be passed up the call stack without masking the original error. i hope this means any errors can be handled at an appropriate error boundary and there will be enough detail in the error to aid debugging and useful error handling. i see there is an Issue open to define errors and handling strategy in the app. i should add any ideas in there i guess.
i have not set up my own instance as yet but i will spin up either a containerized (if one exists with the correct lemmy API) or native instance and try it out. |
As a heads up, I'm likely going to close this PR without merging in the future after #19 gets merged. I have 3 reasons for this:
I will will wait a few days to see if @dessalines has any input on either of our PRs. If we hear nothing back from him after a few more days, I will merge my PR and get started on my attempt at session handling. |
let mut cookie = Cookie::build(path, value).finish(); | ||
let mut now = OffsetDateTime::now_utc(); | ||
now += Duration::weeks(1); | ||
cookie.set_expires(now); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should come from the cookie / auth response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean the expiry date?
sorry i don't think i see one in the login response.
<main class="container mx-auto"> | ||
<Routes> | ||
<Route path="" view=HomeActivity ssr=SsrMode::Async/> | ||
<Route path="home" view=HomeActivity ssr=SsrMode::Async/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should all be able to work with out of order streaming tho, otherwise it'll be much slower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the out of order streaming requires javascript to work which negates the benefits of fully SSR pages
can we change this when we have a full understanding of which pages and how much of those pages needs to be rendered on the server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to. Modes are described here: https://leptos-rs.github.io/leptos/ssr/23_ssr_modes.html
@SleeplessOne1917 don't close this one, @jim-taylor-business fully got authentication working here, as well as a lot of other additions like translations and a fuller navbar. Work with them to fix some of the conflicts, and figure out the optimal way to do authentication. |
There's a |
updates navigation with minimal styling (uses plain daisy/tailwind classes)
other changes included